<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: include/mandarava/event.hpp 源文件</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="../../dir_167799c5d54b642df145e58207d8d1d2.html">mandarava</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">event.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../d1/d92/mandarava_2event_8hpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="preprocessor">#include &lt;sstream&gt;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &quot;<a class="code" href="../../d0/d5c/malloc_shared_ptr_8hpp.html">mallocSharedPtr.hpp</a>&quot;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span> </div>
<div class="foldopen" id="foldopen00014" data-start="{" data-end="};">
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"><a class="line" href="../../d0/de4/structmandarava_evt.html">   14</a></span><span class="keyword">struct </span><a class="code hl_struct" href="../../d0/de4/structmandarava_evt.html">mandaravaEvt</a></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span>{</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="../../d0/de4/structmandarava_evt.html#ab5bc74c2edb98bc4f2b70371d2188b16">   16</a></span>    <span class="keyword">using </span><a class="code hl_class" href="../../da/d39/classwheels_1_1malloc_shared_ptr.html">buff_t</a> = <a class="code hl_class" href="../../da/d39/classwheels_1_1malloc_shared_ptr.html">wheels::mallocSharedPtr&lt; uint8_t &gt;</a>;</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span>    </div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="../../d0/de4/structmandarava_evt.html#ab9ce73f178895e6fff7cc2ec593263e4">   18</a></span>    <a class="code hl_enumeration" href="../../db/d8f/itfc_8hpp.html#a60cb774084c193005ab0b2caa9e36a8f">mandaravaEvtID</a>    <a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab9ce73f178895e6fff7cc2ec593263e4">m_id</a>;           <span class="comment">// 事件类型</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"><a class="line" href="../../d0/de4/structmandarava_evt.html#ab406b692f84b3ab15ca79e1d6938f4b8">   19</a></span>    <a class="code hl_struct" href="../../db/d78/structdata_ch.html">dataCh</a>          * <a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab406b692f84b3ab15ca79e1d6938f4b8">p_ch</a>;           <span class="comment">// 事件发生的对象指针</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="../../d0/de4/structmandarava_evt.html#afb1682968996b0d010803d1d0c748916">   21</a></span>    <a class="code hl_class" href="../../da/d39/classwheels_1_1malloc_shared_ptr.html">buff_t</a>            <a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#afb1682968996b0d010803d1d0c748916">m_buff</a>;         <span class="comment">// 数据缓冲</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="../../d0/de4/structmandarava_evt.html#a922e68584a2c1d54c0d8204b5694c919">   23</a></span>    <a class="code hl_function" href="../../d0/de4/structmandarava_evt.html#a922e68584a2c1d54c0d8204b5694c919">mandaravaEvt</a>( <a class="code hl_enumeration" href="../../db/d8f/itfc_8hpp.html#a60cb774084c193005ab0b2caa9e36a8f">mandaravaEvtID</a> <span class="keywordtype">id</span> , <a class="code hl_struct" href="../../db/d78/structdata_ch.html">dataCh</a> * ch ):<a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab9ce73f178895e6fff7cc2ec593263e4">m_id</a>( id ), <a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab406b692f84b3ab15ca79e1d6938f4b8">p_ch</a>( ch ){};</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span> </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="../../d0/de4/structmandarava_evt.html#a847c7088c1a35f3d1c4c746287439aa7">   25</a></span>    <a class="code hl_function" href="../../d0/de4/structmandarava_evt.html#a847c7088c1a35f3d1c4c746287439aa7">mandaravaEvt</a>( <a class="code hl_struct" href="../../d0/de4/structmandarava_evt.html">mandaravaEvt</a>&amp;&amp; b ):<a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab9ce73f178895e6fff7cc2ec593263e4">m_id</a>( b.<a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab9ce73f178895e6fff7cc2ec593263e4">m_id</a>),<a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab406b692f84b3ab15ca79e1d6938f4b8">p_ch</a>( b.<a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab406b692f84b3ab15ca79e1d6938f4b8">p_ch</a> ), <a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#afb1682968996b0d010803d1d0c748916">m_buff</a>( <a class="code hl_namespace" href="../../d8/dcc/namespacestd.html">std</a>::move( b.<a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#afb1682968996b0d010803d1d0c748916">m_buff</a> )){}</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span> </div>
<div class="foldopen" id="foldopen00027" data-start="{" data-end="}">
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"><a class="line" href="../../d0/de4/structmandarava_evt.html#a2d0af7ff26acf7356c8e02ad4a619598">   27</a></span>    std::size_t <a class="code hl_function" href="../../d0/de4/structmandarava_evt.html#a2d0af7ff26acf7356c8e02ad4a619598">operator</a>( <span class="keyword">const</span> <a class="code hl_struct" href="../../d0/de4/structmandarava_evt.html">mandaravaEvt</a>&amp; obj ){</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span>        std::size_t ret = 0;</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span>        std::stringstream ss;</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span>        ss &lt;&lt; <a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab9ce73f178895e6fff7cc2ec593263e4">m_id</a> &lt;&lt; <span class="stringliteral">&quot;:&quot;</span> &lt;&lt; std::hex &lt;&lt; (<span class="keywordtype">unsigned</span> int )<a class="code hl_variable" href="../../d0/de4/structmandarava_evt.html#ab406b692f84b3ab15ca79e1d6938f4b8">p_ch</a>;</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span>        ret = std::hash&lt; std::string &gt;( ss.str() );</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span>        <span class="keywordflow">return</span> ret;</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span>    }</div>
</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span>};</div>
</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span> </div>
<div class="foldopen" id="foldopen00038" data-start="{" data-end="}">
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="../../d8/dcc/namespacestd.html">   38</a></span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d8/dcc/namespacestd.html">std</a></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span>{</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>    <span class="comment">// 定义hash用于在命令模块中注册自定义的事件</span></div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    <span class="keyword">template</span>&lt;&gt;</div>
<div class="foldopen" id="foldopen00042" data-start="{" data-end="};">
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="../../d4/d2b/structstd_1_1hash_3_01_my_class_01_4.html">   42</a></span>    <span class="keyword">struct </span>hash&lt;MyClass&gt; {</div>
<div class="foldopen" id="foldopen00043" data-start="{" data-end="}">
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="../../d4/d2b/structstd_1_1hash_3_01_my_class_01_4.html#ae4cb24e804558fd671a4f21033811dda">   43</a></span>        std::size_t <a class="code hl_function" href="../../d4/d2b/structstd_1_1hash_3_01_my_class_01_4.html#ae4cb24e804558fd671a4f21033811dda">operator()</a>(<span class="keyword">const</span> MyClass&amp; obj)<span class="keyword"> const </span>{</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>            <span class="keywordflow">return</span> obj(obj);</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>        }</div>
</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span>    };</div>
</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>}</div>
</div>
<div class="ttc" id="aclasswheels_1_1malloc_shared_ptr_html"><div class="ttname"><a href="../../da/d39/classwheels_1_1malloc_shared_ptr.html">wheels::mallocSharedPtr&lt; uint8_t &gt;</a></div></div>
<div class="ttc" id="aitfc_8hpp_html_a60cb774084c193005ab0b2caa9e36a8f"><div class="ttname"><a href="../../db/d8f/itfc_8hpp.html#a60cb774084c193005ab0b2caa9e36a8f">mandaravaEvtID</a></div><div class="ttdeci">mandaravaEvtID</div><div class="ttdef"><b>定义</b> <a href="../../db/d8f/itfc_8hpp_source.html#l00012">itfc.hpp:13</a></div></div>
<div class="ttc" id="amalloc_shared_ptr_8hpp_html"><div class="ttname"><a href="../../d0/d5c/malloc_shared_ptr_8hpp.html">mallocSharedPtr.hpp</a></div></div>
<div class="ttc" id="anamespacestd_html"><div class="ttname"><a href="../../d8/dcc/namespacestd.html">std</a></div><div class="ttdef"><b>定义</b> <a href="#l00038">event.hpp:39</a></div></div>
<div class="ttc" id="astructdata_ch_html"><div class="ttname"><a href="../../db/d78/structdata_ch.html">dataCh</a></div><div class="ttdef"><b>定义</b> <a href="../../de/dfb/data_ch_8hpp_source.html#l00030">dataCh.hpp:31</a></div></div>
<div class="ttc" id="astructmandarava_evt_html"><div class="ttname"><a href="../../d0/de4/structmandarava_evt.html">mandaravaEvt</a></div><div class="ttdoc">定义事件类型</div><div class="ttdef"><b>定义</b> <a href="#l00014">event.hpp:15</a></div></div>
<div class="ttc" id="astructmandarava_evt_html_a2d0af7ff26acf7356c8e02ad4a619598"><div class="ttname"><a href="../../d0/de4/structmandarava_evt.html#a2d0af7ff26acf7356c8e02ad4a619598">mandaravaEvt::operator</a></div><div class="ttdeci">std::size_t operator(const mandaravaEvt &amp;obj)</div><div class="ttdef"><b>定义</b> <a href="#l00027">event.hpp:27</a></div></div>
<div class="ttc" id="astructmandarava_evt_html_a847c7088c1a35f3d1c4c746287439aa7"><div class="ttname"><a href="../../d0/de4/structmandarava_evt.html#a847c7088c1a35f3d1c4c746287439aa7">mandaravaEvt::mandaravaEvt</a></div><div class="ttdeci">mandaravaEvt(mandaravaEvt &amp;&amp;b)</div><div class="ttdef"><b>定义</b> <a href="#l00025">event.hpp:25</a></div></div>
<div class="ttc" id="astructmandarava_evt_html_a922e68584a2c1d54c0d8204b5694c919"><div class="ttname"><a href="../../d0/de4/structmandarava_evt.html#a922e68584a2c1d54c0d8204b5694c919">mandaravaEvt::mandaravaEvt</a></div><div class="ttdeci">mandaravaEvt(mandaravaEvtID id, dataCh *ch)</div><div class="ttdef"><b>定义</b> <a href="#l00023">event.hpp:23</a></div></div>
<div class="ttc" id="astructmandarava_evt_html_ab406b692f84b3ab15ca79e1d6938f4b8"><div class="ttname"><a href="../../d0/de4/structmandarava_evt.html#ab406b692f84b3ab15ca79e1d6938f4b8">mandaravaEvt::p_ch</a></div><div class="ttdeci">dataCh * p_ch</div><div class="ttdef"><b>定义</b> <a href="#l00019">event.hpp:19</a></div></div>
<div class="ttc" id="astructmandarava_evt_html_ab9ce73f178895e6fff7cc2ec593263e4"><div class="ttname"><a href="../../d0/de4/structmandarava_evt.html#ab9ce73f178895e6fff7cc2ec593263e4">mandaravaEvt::m_id</a></div><div class="ttdeci">mandaravaEvtID m_id</div><div class="ttdef"><b>定义</b> <a href="#l00018">event.hpp:18</a></div></div>
<div class="ttc" id="astructmandarava_evt_html_afb1682968996b0d010803d1d0c748916"><div class="ttname"><a href="../../d0/de4/structmandarava_evt.html#afb1682968996b0d010803d1d0c748916">mandaravaEvt::m_buff</a></div><div class="ttdeci">buff_t m_buff</div><div class="ttdef"><b>定义</b> <a href="#l00021">event.hpp:21</a></div></div>
<div class="ttc" id="astructstd_1_1hash_3_01_my_class_01_4_html_ae4cb24e804558fd671a4f21033811dda"><div class="ttname"><a href="../../d4/d2b/structstd_1_1hash_3_01_my_class_01_4.html#ae4cb24e804558fd671a4f21033811dda">std::hash&lt; MyClass &gt;::operator()</a></div><div class="ttdeci">std::size_t operator()(const MyClass &amp;obj) const</div><div class="ttdef"><b>定义</b> <a href="#l00043">event.hpp:43</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
